/***
 *新闻列表
 * XYB
 * ***/
SPA_RESOLVE_INIT = function(transition) {
    var html = '<div class="right-list-box addnews-box mt-20 magin-auto">\n' +
        '<div class="items">\n' +
        '<label>新闻标题：</label>\n' +
        '<input type="text" class="t t1 rad-3 ml-10 f-14" maxlength="20" id="newsTitle"/>\n' +
        '</div>\n' +
        '<div class="items">\n' +
        '<label>新闻内容：</label>\n' +
        '<textarea class="news-txt t2 rad-3 ml-10 pt-5 f-14" maxlength="300" id="newsContent"></textarea>\n' +
        '</div>\n' +
        '<div class="items mt-35">\n' +
        '<label></label>\n' +
        '<a href="javascript:;" class="btn-t c-fff f-14 bg-169 rad-3 ml-10 text-center" onclick="addnewsFun()">提交</a>\n' +
        '</div>\n' +
        '</div> ';
    getHref_path();
    $(".menu ul").hide();
    $(".menu ul").eq(0).show();
    document.getElementById("ui-right-content").innerHTML = html;
}
function addnewsFun(){
    var newsTitle = $("#newsTitle").val();
    var newsContent = $("#newsContent").val();
    if(newsTitle==""){
        $.message("请输入标题");
        return;
    }
    if(newsContent==""){
        $.message("请输入内容");
        return;
    }
    $.ajax({
        url: add_news_interface,
        type:'post',
        dataType:'json',
        xhrFields:{
            withCredentials:true
        },
        crossDomain:true,
        data:{
            newsTitle:newsTitle,
            newsContent:newsContent
        },
        success: function(data) {
            if(data.code==200){
                $.message("添加成功");
                // $(obj).closest("tr").remove();
                location.href="../admin/index.html#/newsList";
            }else{
                parent.popMessage(data.msg);
            }
        },
        error: function (error) {
            $.message("链接超时，请刷新...");
        }
    });
}